<?php  namespace Home\Common\Model;
use Hdphp\Model\Model;
//二级菜单公用模型
class Category extends Model{
//	指定表名
	protected $table = 'category';
//	获取数据
	public function getCate(){
		$cateData = array();
//		查询所有顶级分类
		$cateData = $this->where("pid=0")->get();
		
//		循环顶级分类，插入子分类数组
		foreach($cateData as $k => $v){
			$cateData[$k]['son'] = $this->where("pid={$v['cid']}")->get();
			$cateData[$k]['threeSon'] = $this->where("pid={$v['cid']}")->limit(3)->get();
		}
		return $cateData;
	}
}



 ?>